*** Settings ***
Documentation           通过Redfish获取storage的资源合集
Resource                ../../test_function/redfish/redfish.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${processors_id}        1
${INPUT_URI}            /Systems/${SYSTEM_ID}/Storages

*** Test Cases ***
Get Storages Members Via Redfish
    [Documentation]    通过Redfish获取storage的资源合集
    [Tags]    Get_Storages_Members_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get    ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取storage资源合集失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    200    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证storage资源合集
    ${storages_settings}=    Set Variable    ${rsp[1].json()}
    ${collection_name}=    Set Variable    Storage Collection

    # 检查响应中是否Storages Collection
    Should Be Equal As Strings    ${storages_settings["Name"]}    ${collection_name}
    Log    Storages Collection的架构内容${collection_name}的值为: ${storages_settings["Name"]}    level=INFO
